/* **********************************************************************************
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* **********************************************************************************/

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OfficeOpenXMLInterop;

namespace Theme_Builder
{
    public partial class EditGlow : Form
    {
        public EditGlow()
        {
            InitializeComponent();
        }

        public OfficeOpenXMLInterop.CT_GlowEffect Glow
        {
            get
            {
                CT_GlowEffect glow = new CT_GlowEffect();

                CT_SolidColorFillProperties fillProps = this.editColor.SolidFill;
                if (fillProps.schemeClr != null)
                {
                    glow.schemeClr = fillProps.schemeClr;
                }
                else if (fillProps.srgbClr != null)
                {
                    glow.srgbClr = fillProps.srgbClr;
                }
                else if (fillProps.sysClr != null)
                {
                    glow.sysClr = fillProps.sysClr;
                }

                glow.rad = (long)(float.Parse(this.textBoxRad.Text) * 12700f);

                return glow;
            }
            set
            {
                CT_SolidColorFillProperties fillProps = new CT_SolidColorFillProperties();
                if (value.schemeClr != null)
                {
                    fillProps.schemeClr = value.schemeClr;
                }
                else if (value.srgbClr != null)
                {
                    fillProps.srgbClr = value.srgbClr;
                }
                else if (value.sysClr != null)
                {
                    fillProps.sysClr = value.sysClr;
                }

                this.editColor.SolidFill = fillProps;

                this.textBoxRad.Text = ((float)value.rad / 12700f).ToString();
            }
        }
    }
}